The Bitmap Geometry Structure
ThegxBitmap
structure specifies the geometry of a bitmap shape. You can use this data structure when creating bitmap shapes with theGXNewBitmap
function, when altering bitmap shapes with theGXGetBitmap
andGXSetBitmap
functions, and when directly editing bitmap shapes with theGXGetShapeStructure
function.The
gxBitmap
structure is defined as follows:
typedef struct { char *image; long width; long height; long rowBytes; long pixelSize; gxColorSpace space; gxColorSet set; gxColorProfile profile; } gxBitmap;When creating a bitmap, you can allocate the memory for the pixel image of the bitmap yourself and store a pointer to it in the
Field Description
image
- A pointer to the pixel image. When creating a bitmap, you can specify
nil
for this field to indicate that QuickDraw GX should allocate memory for the pixel image of the bitmap.width
- The width of the bitmap in pixels.
height
- The height of the bitmap in pixels.
rowBytes
- The number of bytes of the pixel image corresponding to each row of the bitmap. This value must be a positive even number.
pixelSize
- The number of bits representing a single pixel in the pixel image. This value must be 1, 2, 4, 8, 16, or 32.
space
- The color space that QuickDraw GX uses when interpreting the pixel values in the pixel image. When creating a bitmap, you may specify the
gxNoSpace
constant for this field to indicate that QuickDraw GX should choose a color space for you. If the value of thepixelSize
field is 32, QuickDraw GX uses the valuegxRGB32Space
; if the pixel size is 16, QuickDraw GX usesgxRGB16Space
; if the pixel size is 8 or less, QuickDraw GX usesgxIndexedSpace
and creates the default color set for the pixel size, which is usually a grayscale color set.set
- The color set that QuickDraw GX uses when interpreting the pixel values of the pixel image. If the
space
field contains the valuegxIndexedSpace
, QuickDraw GX interprets the pixel values in the pixel image as indexes to this color set. If the bitmap's color space is notgxIndexedSpace
, this field should benil
.profile
- The color matching information about the device on which the bitmap was created. You may provide a reference to a color profile object, or you may set the value of this field to
nil
.- Implementation Note
- Version 1.0 of QuickDraw GX limits the bitmap width and the bitmap height to 32,767.
![]()
image
field, or you can set theimage
field tonil
, which indicates that QuickDraw GX should allocate the pixel image memory.If you create the pixel image for a bitmap, you must pad the end of each row of the pixel image so that each row contains an even number of bytes. You must store the number of bytes per row in the
rowBytes
field, unless you are creating a bitmap with a pixel image in QuickDraw GX memory, in which case you want to set this field to 0.If you set the
image
field tonil
when creating a bitmap, QuickDraw GX does two things:
If you want to create a bitmap with a disk-based pixel image, you should specify the
- creates an uninitialized pixel image based on the bitmap width and height you specify in the
width
andheight
fields and the pixel size you specify in thepixelSize
field- determines an appropriate
rowBytes
value
gxBitmapFileAliasImageValue
constant for theimage
field.If you specify the
gxNoSpace
constant for thespace
field, QuickDraw GX chooses an appropriate color space for you, based on the value of thepixelSize
field.If you specify the color space yourself, you must be sure the pixel size of that color space matches the value you indicate in the
pixelSize
field.For a discussion of pixel images, bitmap width, bitmap height, and pixel size, see "Bitmap Geometries" beginning on page 5-5. For a detailed discussion of color spaces, color sets, and color profiles, see the chapter "Color and Color-Related Objects" in Inside Macintosh: QuickDraw GX Objects.
For examples of creating
gxBitmap
structures and bitmap shapes, see "Creating and Drawing Bitmaps" beginning on page 5-15.
Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help